<!Doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>登录 - {$site_name}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="__LAYUI__/style/admin.css" media="all" />
  <link rel="stylesheet" href="__LAYUI__/style/login.css" media="all" />
</head>
<body>
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>{$site_name}</h2>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <form class="layui-form" id="LAY-user-login-submit">
	        <div class="layui-form-item">
	          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
	          <input type="text" name="username" value="{$remember_me|default=''}" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
	        </div>
	        <div class="layui-form-item">
	          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
	          <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
	        </div>
	        <div class="layui-form-item">
	          <div class="layui-row" style="display: flex;align-items: center;">
	            <div class="layui-col-xs7">
	              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-captcha"></label>
	              <input type="text" name="captcha" id="LAY-user-login-captcha" lay-verify="required" placeholder="输入验证码" class="layui-input">
	            </div>
	            <div class="layui-col-xs5">
	              <div style="margin-left: 10px;">
	                <img src="{:captcha_src()}" class="layadmin-user-login-codeimg" id="LAY-user-get-captcha">
	              </div>
	            </div>
	          </div>
	        </div>

	        <div class="layui-form-item" style="margin-bottom: 20px;">
	          <input type="checkbox" name="remember_me" value="1" lay-skin="primary" title="记住我" checked />
	        </div>
	        <div class="layui-form-item">
	          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 录</button>
	        </div>
        </form>
      </div>
    </div>
    <div class="layui-trans layadmin-user-login-footer">
      <p>© <?php echo date('Y');?> <a href="{$_site_url}" target="_blank">848981.net</a></p>
    </div>
  </div>
	<script type="text/javascript" src="__JS__/jquery.min.js"></script>
  <script src="__LAYUI__/layui/layui.js"></script>
  <script>
  layui.use(['layer', 'form'], function(){
    var $ = layui.$
    ,form = layui.form;
    form.render();
    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){
		var url = "{:url('login/login')}";
		var data = $('#LAY-user-login-submit').serialize();
		$.post(url, data, function(res){
			layer.msg(res.msg, {offset: '50px',anim: 1});
			if (res.code == 0) {
				window.location.href = res.data;
			} else {
				$('#LAY-user-get-captcha').click();
			}
		});
		return false;
    });
    
    // 验证码
    $('#LAY-user-get-captcha').on('click', function(){
		this.src = "{:captcha_src()}?" + Math.random();
	});
  });
  </script>
</body>
</html>